<?php



session_start();

include("../include/configuration.php");

include("../include/database.php");

$obj_config = new Config();



class xl_dangnhap extends database

{

	function DangNhap($tendn, $mk)

	{

		$sql = "select * from nguoidung where tendangnhap = '".$tendn."' and matkhau = '".$mk."'";
		$this->setquery($sql);

		$arr = $this->loadAllRow();

		$this->disconnect();

		return $arr;
		
	}



	

}



$ten = $_REQUEST['txt_username'];

$matkhau = $_REQUEST['txt_pass'];

$dn = new xl_dangnhap();

$matkhau = trim($matkhau);

//echo $matkhau;

$matkhau = md5(md5(md5(md5($matkhau))));



$arr = $dn->DangNhap($ten,$matkhau);

if($arr)

{

	$_SESSION['TenDN'] = $ten;

	$_SESSION['MatKhau'] = $matkhau;

	$_SESSION['PhanQuyen'] = $arr[0]['admin'];

	$_SESSION['MaNguoiDung'] = $arr[0]['manguoidung'];

	header("location: ../Pages/admin/trangchu.php");

}

else

{

	/*echo "<script>alert('Tên đăng nhập hoặc mật khẩu không tồn tại');</script>";*/

	header("location: ../Pages/admin/Login.php");

}

?>